package edu.nanyang.struts;

import java.util.Date;
import java.util.List;

import org.apache.struts2.json.annotations.JSON;

import com.opensymphony.xwork2.ActionSupport;

import edu.nanyang.domain.Notice;
import edu.nanyang.hibernate.INotice;

public class NoticeAction  extends ActionSupport{
	private Notice notice;
	private INotice inotice;
	private List<Notice> notices;
	public Notice getNotice() {
		return notice;
	}

	public void setNotice(Notice notice) {
		this.notice = notice;
	}

	@JSON(serialize=false)
	public INotice getInotice() {
		return inotice;
	}

	public void setInotice(INotice inotice) {
		this.inotice = inotice;
	}

	public String addnotice(){
		notice.setPublishtime(new Date());
		inotice.addnotice(notice);
		return SUCCESS;
		
	}
	public String getAllNotices(){
		this.notices=this.inotice.getNotices();
		return SUCCESS;
	}
	public List<Notice> getNotices() {
		return notices;
	}

	public void setNotices(List<Notice> notices) {
		this.notices = notices;
	}
	
}
